package btd.game.dlgs;

import btd.game.ConstData;
import btd.game.activities.PBoardAct;
import btd.game.activities.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ZuiZResultDlg extends Dialog {
	private PBoardAct owner = null;

	public ZuiZResultDlg(Context context) {
		super(context);
		owner = (PBoardAct) context;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.zuizhongresultdlg);
		((TextView) findViewById(R.id.TextViewZZRBDiCount)).setText(String
				.valueOf(owner.decision.bDiCount));
		((TextView) findViewById(R.id.TextViewZZRBQiCount)).setText(String
				.valueOf(owner.decision.bQiCount));
		((TextView) findViewById(R.id.TextViewZZRWDiCount)).setText(String
				.valueOf(owner.decision.wDiCount));
		((TextView) findViewById(R.id.TextViewZZRWQiCount)).setText(String
				.valueOf(owner.decision.wQiCount));
		((Button) findViewById(R.id.ButtonZuizhongresultOK)).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View arg0) {
						owner.qiutouResultCancel();
						ZuiZResultDlg.this.cancel();
					}
				});
		if(owner.decision.winer == ConstData.QIZI_BLACK) {
			this.setTitle(R.string.heisheng);
		} else if(owner.decision.winer == ConstData.QIZI_WHITE) {
			this.setTitle(R.string.baisheng);
		} else {
			this.setTitle("");
		}
	}
}
